package com.why.jvm.hotspot.src.share.vm.oops.constants;

import lombok.Data;

/**
 * @author xiaoTian
 * @date 2022/7/22 14:24
 * @Description:
 */
@Data
public class ConstantMethodrefInfo extends ConstantInfoBase{

    private int classIndex;

    private int nameAndTypeIndex;


    public ConstantNameAndTypeInfo getConstantNameAndTypeInfo(){
        return (ConstantNameAndTypeInfo)getConstantPool().getConstantPoolMap().get(nameAndTypeIndex);
    }

    public ConstantClass getConstantClass(){
        return (ConstantClass) getConstantPool().getConstantPoolMap().get(classIndex);
    }

    @Override
    public String toString() {
        return "ConstantMethodrefInfo{" +
                "classIndex=" + classIndex +
                ", nameAndTypeIndex=" + nameAndTypeIndex +
                ",class=" + getConstantClass().getName() +
                ", nameAndType=" + getConstantNameAndTypeInfo().getName()+
                '}';
    }
}
